package 天梯赛.tts44.tss27;

import java.util.*;
//关系的映射
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String str=sc.nextLine();
        //一共就九位数组
        int a[]=new int[10];
        for (int i = 0; i < str.length(); i++) {
            int x=str.charAt(i)-'0';
            a[x]++;
        }
        //a[1] 不等于
        Map<Integer,Integer> map=new HashMap<>();
        int index=0;
        List<Integer> list=new ArrayList<>();
        for (int i = 9 ;i>=0; i--) {
            if (a[i]!=0){
                list.add(i);
                //map来映射接节点之间的关系
                map.put(i,index++);
            }
        }
        StringBuffer sb=new StringBuffer("int[] arr = new int[]{");
        for (int i = 0; i < list.size(); i++) {
            sb.append(list.get(i)+",");
        }
        sb.deleteCharAt(sb.length()-1);
        sb.append("};");
        System.out.println(sb.toString());
        StringBuffer  s2=new StringBuffer("int[] index = new int[]{");
        for (int i = 0; i < str.length(); i++) {
            int x=str.charAt(i)-'0';
            Integer i1 = map.get(x);
            s2.append(i1+",");
        }
        s2.deleteCharAt(s2.length()-1);
        s2.append("};");
        System.out.println(s2.toString());
    }
}
